from django.contrib import admin

# Register your models here.

from blog.models import Banner,Category,Tui,Tag,Article,Link
#导入需要管理的数据库表

class BannerAdmin(admin.ModelAdmin):
    list_display = ("id","text_info","img","link_url","is_active")

admin.site.register(Banner,BannerAdmin)

@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
    list_display = ('id','category','title','tui','user','views','created_time') # 文章列表里显示想要显示的字段
    list_per_page = 50          # 满50条数据就自动分页
    ordering = ("-created_time",)    #后台数据列表排序方式
    list_display_links = ("id","title")     # 设置哪些字段可以点击进入编辑界面


@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'index')

@admin.register(Tag)
class TagAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')

@admin.register(Tui)
class TuiAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')

@admin.register(Link)
class LinkAdmin(admin.ModelAdmin):
    list_display = ('id', 'name','linkurl')